import QtQuick 2.8
import QtQuick.Window 2.2
import Qt.labs.platform 1.0
import org.fileio 1.0

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello Qt")

    TestObject{
        id: testProperty
        title: qsTr("Hello World")
    }

    Component.onCompleted: {
        title = testProperty.title;
    }
}



/*
Window {
    visible: true
    width: 440
    height: 300
    title: qsTr("Context fileIO")
    Column{
        Rectangle{
            id:contentRect
            x:10; y:10
            width: 400
            height: 150

            //用于显示打开的文本文件的内容
            Text{
                id:content
                anchors.top :contentRect.top
                anchors.bottom: contentRect.bottom
                anchors.left: contentRect.left
                anchors.right: contentRect.right
                text: fileIO.text
            }
            border.color: "#CCCCCC"
        }

        //点击的按钮用来选择对应的文件
        Rectangle{
            anchors.horizontalCenter:contentRect.horizontalCenter
            color: "#4D9CF8"
            width:200
            height: 30
            Text{
                anchors.centerIn: parent
                text:"点击打开文件"
            }
            //点击按钮弹出选择文件的对话框
            MouseArea {
                anchors.fill: parent
                onClicked: {
                    fileDialog.open();
                }
            }
        }
    }
    //文件选择窗口,选择需要打开的文件
    //并读取文件中对应的内容
    FileDialog{
        id: fileDialog
        folder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
        onFileChanged: {
            fileIO.source = fileDialog.file;
            fileIO.read();
        }
    }

    //外部导入的C++类型，可以直接定义使用
    //外部通过ID来访问该模块
    FileIO{
        id:fileIO
    }
}


*/
